package random

func Min[T Number](v ...T) T {
	var r T = v[0]
	for i := 1; i < len(v); i++ {
		if v[i] < r {
			r = v[i]
		}
	}
	return r
}

func Max[T Number](v ...T) T {
	var r T = v[0]
	for i := 1; i < len(v); i++ {
		if v[i] > r {
			r = v[i]
		}
	}
	return r
}

// Triad 三目运算
func Triad[T any](b bool, s1, s2 T) T {
	if b {
		return s1
	}
	return s2
}
